<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page import="org.springframework.web.context.support.WebApplicationContextUtils" %>
<%@ page import="org.springframework.context.ApplicationContext" %>
<%@page import="java.net.URLDecoder"%>
<%@ page import="com.sz.common.SZUtility" %>
<%@page import="com.sz.businessgroup.dao.IBusinessGroupDAO"%>
<%@ page import="com.sz.common.ICommonDAO" %>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String style1 = "width: 80;text-align:right;font-size: 12px;";
String style2 = "width: 120px";
String style3 = "color: red;text-align:left;";
String style4 = "font-size: 12px;";
%>

<%
ServletContext servletContext = request.getSession().getServletContext(); 
ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(servletContext);


//区域
String tmp = null;
tmp = request.getParameter("region");
String region = (tmp!=null) ? tmp : "";
String create_manager = request.getSession().getAttribute("userid").toString();
String region_id = request.getSession().getAttribute("regionid").toString();
ICommonDAO dao = (ICommonDAO) context.getBean("CommonDAO");
String Region_sql = "select region_id,REGION_NAME from region where parent_id = " + region_id;
List list_Area = dao.queryForList(Region_sql);

%>



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
	<link href="<%= request.getContextPath() %>/css/main.css" rel="stylesheet" type="text/css" />		
		<base href="<%=basePath%>" target="_self">
		<title>新增商圈信息</title>
		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="addTicket">
		<meta http-equiv="description" content="新增商圈信息">
	</head>
	
	<body>
		<script type="text/javascript" src="js/calendar.js"></script>
		<script type="text/javascript" src="js/utility.js"></script>	
		
	  	<form name="addBusinessGroup_form"  action="addBusinessGroup.exec" method="post" onsubmit="return check()"> 
	  	
	  	<table width="100%" height="50px" border="0" cellpadding="0" cellspacing="0">
	  	<tr>
		  	<td class="title0">新增商圈信息<br></td>
		</tr>
	  	</table>
	  	
	  	 <table width="100%" border="0" >
	  	 
	  	 
	  	<tr>
	  	</tr>
  		<tr>
			<td style="<%=style1%>">行政区域<br></td>
	        <td>
		  		<select id="business_region_id" name="business_region_id" style="width:156px">
				  <option value="">请选择</option>
				   <%
				     boolean b = false;
				   	 String value = null;
				     String text = null;
				   %>
				   <%
				   for(int n = 0; n < list_Area.size(); ++n)
				   {    
					   Map map = (Map)list_Area.get(n);
					   value = map.get("REGION_ID").toString();
					   text = map.get("REGION_NAME").toString();
					   b = value.equals(region);
				   %>
				   <option <%if(b){%> selected="selected" <%}%>
				     value="<%=value%>"><%=text%>
				   </option>
				   <%}%>				   
				</select>
			    <font style="<%=style3%>">*</font>
		  	</td>
		  	<td style="<%=style1%>">商圈名称&nbsp<br></td>
	  		<td>
	  			<input type="text" id="BusinessGroup_Name" name="BusinessGroup_Name"  style="<%=style2%>">
	  			<font style="<%=style3%>">*</font>
	  		</td>
  			<td style="<%=style1%>">商圈编码&nbsp</td>
  			<td>
  				<input type="text" id="BusinessGroup_Code" name="BusinessGroup_Code" style="<%=style2%>" >
  				<font style="<%=style3%>">*</font>
  			</td>  		
	  	</tr>

        <tr>
        </tr>
        <tr>
        </tr>
	  	<tr>
	  		
		  	<td style="<%=style1%>"></td>
		  	<td>
		  	</td>
		  	<td>
		  	</td>
		  	<td>
		  	</td>
		  	<td>
		  	</td>
		  	<td>
		  		<input type="submit" value="新增商圈" style="width: 80px;height: 40px;">
		  	</td>
	  	</tr>	  		  		  	 
	 	
	  	</table>
	  	
	  	<br/> 
  	</form>
 	
  	
  	<SCRIPT LANGUAGE="JavaScript">
  			function check() 
  			{
  				var tmp;
   			 	tmp = document.getElementById("business_region_id").value;
  				if(IsEmpty(tmp)==true) {
  	  				alert("请选择行政区域");
  	  				return false;
  				} 
  				tmp = document.getElementById("BusinessGroup_Name").value;
  				if(IsEmpty(tmp)==true) {
  	  				alert("请输入商圈名称");
  	  				return false;
  				} 
  				tmp = document.getElementById("BusinessGroup_Code").value;
  				if(IsEmpty(tmp)==true) {
  	  				alert("请手动输入商圈编码");
  	  				return false;
  				} 
  				
  			}
  	</SCRIPT>
	</body>
</html>
